// DynamicTestDiag.cpp : implementation file
//

#include "stdafx.h"
#include "ExperimentScheduler.h"
#include "DynamicTestDiag.h"


// CDynamicTestDiag dialog

IMPLEMENT_DYNAMIC(CDynamicTestDiag, CDialog)

CDynamicTestDiag::CDynamicTestDiag(CWnd* pParent /*=NULL*/)
	: CDialog(CDynamicTestDiag::IDD, pParent)
	, m_strInstruction(_T("Dynamic Test: Peers join and leave the overlay dynamically during the whole experiment. Data is inserted evenly at the beginning of the experiment."))
{

}

CDynamicTestDiag::~CDynamicTestDiag()
{
}

void CDynamicTestDiag::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_strInstruction);
}


BEGIN_MESSAGE_MAP(CDynamicTestDiag, CDialog)
	ON_BN_CLICKED(IDC_BUTTON_RUN, &CDynamicTestDiag::OnBnClickedButtonRun)
	ON_BN_CLICKED(IDC_BUTTON_Open_Configuration, &CDynamicTestDiag::OnBnClickedButtonOpenConfiguration)
	ON_BN_CLICKED(IDC_BUTTON_Open_Folder, &CDynamicTestDiag::OnBnClickedButtonOpenFolder)
END_MESSAGE_MAP()


// CDynamicTestDiag message handlers

void CDynamicTestDiag::OnBnClickedButtonRun()
{
	// TODO: Add your control notification handler code here
	CString cmd( m_strCurPath);
	cmd.Append("MkadPlus.exe");
	WinExec(cmd.GetString(),SW_SHOW);
}

BOOL CDynamicTestDiag::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	GetModuleFileName(NULL, m_strCurPath.GetBufferSetLength(MAX_PATH+1), MAX_PATH);
	m_strCurPath.Delete(m_strCurPath.ReverseFind('\\')+1,m_strCurPath.GetLength()-1-m_strCurPath.ReverseFind('\\'));
	m_strCurPath.Append("DynamicTest\\");
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CDynamicTestDiag::OnBnClickedButtonOpenConfiguration()
{
	// TODO: Add your control notification handler code here
	CString cmd("notepad.exe ");
	cmd.Append( m_strCurPath);
	cmd.Append("parameter\\Parameter.xml");

	WinExec(cmd.GetString(),SW_SHOW);
}

void CDynamicTestDiag::OnBnClickedButtonOpenFolder()
{
	// TODO: Add your control notification handler code here
	ShellExecute(NULL , "open", m_strCurPath, NULL, NULL, SW_SHOWNORMAL); 
}
